﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MSIACCSL2.ViewModels;

namespace MSIACCSL2.Views.Inventory
{
    public partial class Add : ChildWindow
    {

        public InventoryViewModel ViewModel
        {
            get
            {
                return this.DataContext as InventoryViewModel;
            }
        }
        public Add()
        {
            InitializeComponent();
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        private void txtSearchPallet_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
        	if(e.Key == Key.Enter)
                ViewModel.GetPalletlist((sender as TextBox).Text);
        }

        private void btnSelect_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	ViewModel.LoadDetailFromFile(null);
        }

        private void btnSearch_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	this.DialogResult = false;
        }
    }
}

